from pyecharts.charts import Pie
from pyecharts import options as opts
from pyecharts.globals import ThemeType
from Test.dataSource.Data import data
data_xz = data.loc[data['AreaOfRisk'] != 0, :]
a_1 = data_xz["region"].to_list()
b_1 = data_xz["AreaOfRisk"].to_list()

pie = (
    Pie(init_opts=opts.InitOpts(theme=ThemeType.LIGHT, width="700px", height="700px", ), )
        .add(
        " ", [list(z) for z in zip(a_1, b_1)], radius=["40%", "55%"],  # 饼图的半径
    )
        .set_global_opts(title_opts=opts.TitleOpts(
        title="风险地区数量", pos_top='49%', pos_left='39%',
        title_textstyle_opts=opts.TextStyleOpts(color='#CCFFFF'), ),
        legend_opts=opts.LegendOpts(is_show=False),
    )
)
# pie.render_notebook()
pie.render("../TestHTML/TestHtml-b/pie.html")
